package cn.tedu.review;

import java.io.*;

/**本类用于回顾多种流对象的创建方式*/
public class CreateStream {
    public static void main(String[] args) {
        f1();
        f2();

    }

    //本方法用于复习字符流对象的创建
    private static void f2() {
        /**字符输入流创建方式*/
        try {
//            Reader in = new Reader();//抽象父级不可实例化
//            Reader in = new FileReader();//多态创建
            FileReader in1 = new FileReader(new File(""));
            FileReader in2 = new FileReader("");

            BufferedReader in3 =new BufferedReader(new FileReader(new File("")));
            BufferedReader in4 = new BufferedReader(new FileReader(""));

            /**字符输出流创建方式*/
            FileWriter out1 = new FileWriter(new File(""));
            FileWriter out2 = new FileWriter("");
            FileWriter out3 = new FileWriter(new File(""),true);
            FileWriter out4 = new FileWriter("",true);

            BufferedWriter out5 = new BufferedWriter(new FileWriter(new File("")));
            BufferedWriter out6 = new BufferedWriter(new FileWriter(""));
            BufferedWriter out7 = new BufferedWriter(new FileWriter(new File(""),true));
            BufferedWriter out8 = new BufferedWriter(new FileWriter("",true));



        }catch(Exception e){
            e.printStackTrace();
        }



    }
    //本方法用于复习字节流对象的创建
    private static void f1() {
        InputStream in =null;
        /**复习字节输入流的创建方式*/
//         InputStream in= new InputStream()//会报错，抽象父级不可实例化
//           InputStream in = new FileInputStream();//多态创建

        try{
            in = new FileInputStream(new File(""));
            in = new FileInputStream("");

            FileInputStream in1 = new FileInputStream("");
            FileInputStream in2 = new FileInputStream(new File(""));
            BufferedInputStream in3 = new BufferedInputStream(new FileInputStream(""));
            BufferedInputStream in4 = new BufferedInputStream(new FileInputStream(new File("")));

        }catch(Exception e){
            e.printStackTrace();
        }finally {}

        /**复习字节输出流的创建方式*/
        try {
            OutputStream out = new FileOutputStream("");

            FileOutputStream out1 = new FileOutputStream(new File(""));
            FileOutputStream out2 = new FileOutputStream("");
            FileOutputStream out3 = new FileOutputStream(new File(""),true);
            FileOutputStream out4 = new FileOutputStream("",true);

            BufferedOutputStream out5 = new BufferedOutputStream(new FileOutputStream(new File("")));
            BufferedOutputStream out6 = new BufferedOutputStream(new FileOutputStream(""));
            BufferedOutputStream out7 = new BufferedOutputStream(new FileOutputStream(new File(""),true));
            BufferedOutputStream out8 = new BufferedOutputStream(new FileOutputStream("",true));

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}
